package library

import (
	"chat.com/model"
	"chat.com/setting"
)

const (
	defaultAppId = 101 // 默认平台Id
)

var (
	appIdList  = []int64{defaultAppId, 102, 103, 104} // 全部的平台
	serverIp   string
	serverPort string
)

func GetAllAppId() []int64 {
	return appIdList
}

func GetServer() (server *model.Server) {
	server = model.NewServer(serverIp, serverPort)
	return
}

func InAppIds(appId int64) (inAppId bool) {
	for _, value := range appIdList {
		if value == appId {
			inAppId = true
			return
		}
	}

	return
}

func GetDefaultAppId() (appId int64) {
	appId = defaultAppId
	return
}

func IsLocalServer(serverAddr string) (isLocal bool) {
	if serverAddr == setting.RpcServerSetting.Host {
		isLocal = true
	}
	return
}
